package com.imagecollector.common.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: wrf
 * @Date: 2024/6/29 11:45
 * @Description: ThreadLocal工具类
 */
public class ThreadLocalUtil {

    private static final ThreadLocal<Map<String, Object>> threadLocal = ThreadLocal.withInitial(HashMap::new);

    public static void set(String key, Object value) {
        threadLocal.get().put(key, value);
    }

    public static Object get(String key) {
        return threadLocal.get().get(key);
    }

    public static void remove() {
        threadLocal.remove();
    }

}
